lapop12 = readRDS('data/lapop12.rds')

#### Histograms #### 
torture_hist = lapop12 %>%
  filter(is.na(torture_lvl) == F) %>% 
  group_by(torture_lvl, trial) %>%  
  summarise(n_cat = n()) %>%  
  group_by(trial) %>%  
  mutate(n_time = sum(n_cat), 
         Trial = if_else(trial == 0, 'Pre Verdict', 'Post Verdict')) %>%  
  ungroup() %>%  
  mutate(n_share = n_cat/n_time) %>% 
  ggplot() +
  facet_wrap( ~ factor(Trial, levels = c('Pre Verdict', 'Post Verdict')), ncol=2) + 
  geom_bar(aes(x=torture_lvl,y=n_share),stat="identity") + 
  xlab('Torture (Levels)') + 
  ylab('Percent of Respondents') + 
  theme_tufte()
ggsave('fig-out/torture_hist.pdf', torture_hist)



#### Social Cleanse #### 

scl_hist = lapop12 %>%
  filter(is.na(soc.cl_lvl) == F) %>% 
  group_by(soc.cl_lvl, trial) %>%  
  summarise(n_cat = n()) %>%  
  group_by(trial) %>%  
  mutate(n_time = sum(n_cat), 
         Trial = if_else(trial == 0, 'Pre Verdict', 'Post Verdict')) %>%  
  ungroup() %>%  
  mutate(n_share = n_cat/n_time) %>% 
  ggplot() +
  facet_wrap( ~ factor(Trial, levels = c('Pre Verdict', 'Post Verdict')), ncol=2) + 
  geom_bar(aes(x=soc.cl_lvl,y=n_share),stat="identity") + 
  xlab('Social Cleansing (Levels)') + 
  ylab('Percent of Respondents') + 
  theme_tufte()

ggsave('fig-out/scl_hist.pdf', scl_hist)